<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app"></div>
<script src="js/react.development.js"></script>
<script src="js/react-dom.development.js"></script>
<!--Babel-->
<script src="js/babel.min.js"></script>

<script type="text/jsx">

    function Header({title}) {
        console.log(title);
        return (
            <p>{title}</p>
        )
    }


    function Homepage() {
        const names = ["hello", "abc", "def", "ghk"];

        const [likes,setLikes] = React.useState(0);

        function handleClick(){
            console.log("clicked")
            setLikes(likes+1);
        }

        return (
            <div>
                <Header title="very good"/>
                <ul>
                    {
                        names.map((item => (
                            <li>{item}</li>
                        )))
                    }
                </ul>
                <button onClick={handleClick}>Like ({likes})</button>
                <Header title={likes}/>
            </div>
        );
    }

    const app = document.getElementById('app');
    const root = ReactDOM.createRoot(app);
    root.render(<Homepage/>);
</script>

</body>
</html>
